package com.mingle.iwalk;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;

public class SettingsActivity extends Activity {

	 
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.settings_layout);
        
        Button exitBtn = (Button) findViewById(R.id.exit_btn);
        exitBtn.setOnClickListener(mExitListener);
        
        ListView settingsList = (ListView) findViewById(R.id.settings_list);
        
        Resources res = getContext().getResources();
        String [] dataList={res.getString(R.string.backup_restore), res.getString(R.string.set_account),res.getString(R.string.sw_info)};
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(getContext(), android.R.layout.simple_list_item_1, dataList);
        settingsList.setAdapter(adapter);
        settingsList.setOnItemClickListener(new OnItemClickListener()
        {

			@Override
			public void onItemClick(AdapterView<?> parent, View v, int pos,
					long id) {
				switch(pos)
				{
				case 0:
				{
					Intent i = new Intent(getContext(), BackupActivity.class);
					startActivity(i);
				}
					break;
					
				case 1:
				{
					Intent i = new Intent(getContext(), LogingActivity.class);
					startActivity(i);
				}
					break;
					
				case 2:
				{
					Intent i = new Intent(getContext(), SoftwareInfoActivity.class);
					startActivity(i);
				}
					break;
				}
			}
        	
        });
    }
    
	private OnClickListener mExitListener = new OnClickListener()
	{

		@Override
		public void onClick(View v) {
			finish();
		}
		
	};
	
	private Context getContext()
    {
    	return SettingsActivity.this;
    }
}
